package com.yuqian.JavaSe.niuke;

import java.util.*;

public class Same {
    public static boolean checkSam(String stringA, String stringB) {
        // write code here
    	if(stringA==null||stringB==null){
    		return false;
    	}
    	if(stringA.isEmpty()&&stringA.isEmpty()){
    		return true;
    	}
    	char[] a = stringA.toCharArray();
    	char[] b = stringB.toCharArray();
    	if(a.length!=b.length){
    		return false;
    	}
    	Arrays.sort(a);
    	Arrays.sort(b);
    	for(int i=0;i<a.length;i++){
    		if(a[i]!=b[i]){
    			return false;
    		}
    	}
    	return true;
    }
    public static void main(String[] args) {
    	System.out.println(Same.checkSam("This is nowcoder", "is This nowcoder"));
    	System.out.println(Same.checkSam("Here you are", "Are you here"));
	}
}